﻿using IntelligentAgriculture.Contracts.Interface.SheepFileModelInterface;
using IntelligentAgriculture.Domain.Entity;
using IntelligentAgriculture.WebAPI.Application.Command.SheepfilemodelCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.SheepfilemodelCommandHandler
{
	/// <summary>
	/// 根据生长阶段和在场状态获取耳号
	/// </summary>
	public class GrothSheepfilemodelCommandHandler : IRequestHandler<GrothSheepfilemodelCommand, Results<IQueryable<Sheepfilemodel>>>
	{
		private readonly ISheepFileModelService _sheepFileModelService;
		public GrothSheepfilemodelCommandHandler(ISheepFileModelService sheepFileModelService)
		{
			_sheepFileModelService = sheepFileModelService;
		}
		/// <summary>
		/// 根据生长阶段和在场状态获取耳号
		/// </summary>
		public async Task<Results<IQueryable<Sheepfilemodel>>> Handle(GrothSheepfilemodelCommand request, CancellationToken cancellationToken)
		{
			var result = await _sheepFileModelService.GrothSheepfilemodel(request.presentState, request.sheepType,request.growthstage);
			return Results<IQueryable<Sheepfilemodel>>.DataResult(result);
		}
	}
}
